const express = require('express');
const danmuController = require('./../controllers/danmuController');
const authController = require('./../controllers/authController');
const router = express.Router({ mergeParams: true });

// P0ST /users/234fad4/videos/:videoId/danmus

//获取视频下的所有弹幕，不是全部弹幕
router
  .route('/')
  .get(danmuController.setdanmuUserId, danmuController.getAllDanmus);
router.use(authController.protect);
router.route('/').post(
  danmuController.setdanmuUserId,
  // authController.restrictTo('user'),
  danmuController.createDanmu
);

//search for the specific danmu(查找指定的评论)
router
  .route('/:id')
  .get(danmuController.getdanmu)
  .delete(danmuController.deletedanmu);
module.exports = router;
